﻿@model ESupervision.Models.MeetingEvent
@{
    ViewBag.Title = "Details Meeting Event";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Meetings Management</h2>
@if (Model.AlertTime <= DateTime.Now && DateTime.Now < Model.StartTime)
{
    <div class="alert alert-info alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Heads up!</strong> You will have the meeting at @Model.StartTime
    </div>
}
else if (Model.StartTime <= DateTime.Now && DateTime.Now < Model.EndTime)
{
    <div class="alert alert-warning alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Warning!</strong> The meeting started at @Model.StartTime
    </div>
}
else if (DateTime.Now >= Model.EndTime)
{
    <div class="alert alert-danger alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <strong>Oh snap!</strong> The meeting finished at @Model.EndTime
    </div>
}
<div class="row" style="margin:15px 0;">
    <div class="panel panel-warning">
        <div class="panel-heading">
            <h3 class="panel-title" id="panel-title">Information about Meeting Event<a class="anchorjs-link" href="#panel-title"><span class="anchorjs-icon"></span></a></h3>
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-2"><b>Name:</b></div>
                <div class="col-md-4">@Model.Subject</div>
                <div class="col-md-2"><b>Content:</b></div>
                <div class="col-md-4">@Model.Body</div>
            </div>
            <div class="row">
                <div class="col-md-2"><b>Start time:</b></div>
                <div class="col-md-4">@Model.StartTime</div>
                <div class="col-md-2"><b>End time:</b></div>
                <div class="col-md-4">@Model.EndTime</div>
            </div>
        </div>
    </div>
</div>
@if (User.IsInRole("Teacher"))
{
    <div class="row" style="margin:15px 0;">
        <div class="col-md-6">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title" id="panel-title"><a class="anchorjs-link" href="@Url.Action("Index", "MeetingNote", new {id = Model.MeetingEventID })">Your Meeting Notes Management</a></h3>
                </div>
                <div class="panel-body">
                    <div class="list-group">
                        @foreach (var item in Model.MeetingNotes.OrderByDescending(n => n.CreatedTime))
                    {
                        if (item.CreatedTime > DateTime.Now.AddDays(-3))
                        {
                    <a href="#" class="list-group-item">
                        <b>@item.Note</b> <span class="badge">New Note</span>
                    </a>
                        }
                        else
                        {
                    <a href="#" class="list-group-item">
                        <b>@item.Note</b>
                    </a>
                        }
                    }
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="panel panel-danger">
                <div class="panel-heading">
                    <h3 class="panel-title" id="panel-title"><a class="anchorjs-link" href="@Url.Action("Index", "MeetingEventParticipant", new { id = Model.MeetingEventID })">Meeting Event Participants Management</a></h3>
                </div>
                <div class="panel-body">
                    <div class="list-group">
                        @foreach (var item in Model.Participants)
                    {
                    <a href="#" class="list-group-item">
                        <b>@item.RequestedUser.FullName</b> <span class="badge">Requested</span>
                    </a>
                    }
                    </div>
                </div>
            </div>
        </div>
    </div>
}